motor_com=serial('COM4','BaudRate',9600);
fopen(motor_com);
fprintf(motor_com,'en\n');  %% for MCBL 3006S-RS, T-1A new control box.

while(isStopped(motor_com)>0)
    pause(0.5);
end

disp('Initialization of the motor');
fprintf(motor_com,'enprog\n');
fprintf(motor_com,'jmp12\n');
fclose(motor_com);

disp('Seeking zero position of the motor');
fopen(motor_com);
temp1 = 100;
while temp1 < 10000
    temp1_raw = fscanf(motor_com);
    temp1 = abs(str2double(temp1_raw));
end
disp('The FB will be released...');
pause(5);
temp2 = 100;
while temp2 < 10000
    temp2_raw = fscanf(motor_com);
    temp2 = abs(str2double(temp2_raw));
end
fclose(motor_com);
fprintf('motor_zero reversing revolusions: %6.0f.\n',temp1-temp2);

clear temp1;
clear temp1_raw;
clear temp2;
clear temp2_raw;

clear temp